<template>
    <div class="title overhidden">
      <div class="left textCenter logo">
        一诺云检系统
      </div>
      <div class="right">
        <Dropdown placement="bottom-end" @on-click="exitLogin" trigger="click">
          <a href="javascript:void(0)"  >
            {{uname}}
          </a>
          <DropdownMenu slot="list">
            <DropdownItem name="exit">退出</DropdownItem>
          </DropdownMenu>
        </Dropdown>
      </div>
    </div>
</template>
<script type="text/ecmascript-6">

    export default {
        name:"Header",
        data() {
            return {
                uname: "用户名"
            }
        },
        mounted(){
          var user = sessionStorage.getItem("username");
          this.uname = user;
        },
      methods:{
        exitLogin(type){
          if(type=="exit"){
            sessionStorage.removeItem("username");
            sessionStorage.removeItem("token");
            this.$router.push("/");
          }
        },
      }
    }
</script>
<style>
  .title{
    width: 100%;
    height: 70px;
    line-height: 70px;
    background: #20a0ff;
    color: #fff;
    font-size: 22px;
    box-sizing: border-box;
    position: fixed;
    top:0;
    z-index: 9999;
  }
  .logo{
    width: 250px;
  }
  .right{
    padding-right: 50px;
  }
  .right a{
    color: #fff;
    font-size: 16px;
  }
</style>
